package services

import (
	"cloud-navigation/app/common/request"
	"cloud-navigation/app/common/response"

	"github.com/gin-gonic/gin"
)

func Request(c *gin.Context, form interface{}) bool {
	if err := c.ShouldBindJSON(&form); err != nil {
		field, msg := request.GetErrorMsg(form, err)
		response.ValidateFail(c, msg, response.Validator{
			Field:   field,
			Message: msg,
		})
		return false
	}
	return true
}
